import { Toast } from '@douyinfe/semi-ui';
import { MessageInstance } from '@shared/components/Message';
import React from 'react';

const AdminMessageInstance: MessageInstance = {
    info(text: string) {
        Toast.info({
            content: text,
        });
    },
    error(text: string | Error) {
        Toast.error({
            content: text instanceof Error ? text.message || text.toString() : text,
        });
    },
    warn(text: string) {
        Toast.warning({
            content: text,
        });
    },
    success(text: string) {
        Toast.success({
            content: text,
        });
    }
};

export default AdminMessageInstance;
